﻿/*!	@file	r_math_colorRGBf.h
	@brief	浮動少数値色定義
Copyright (c) 2009 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef _R_MATH_COLORRGBF_H_
#define _R_MATH_COLORRGBF_H_


#include "r_math_def.h"

namespace r{
	namespace math{
		struct ColorRGBi;
		struct ColorHSLf;


		struct ColorRGBf {
		public:
			//! コンストラクタ
			ColorRGBf ( void );
			ColorRGBf ( const ColorRGBi& color );
			ColorRGBf ( r_f32 _r, r_f32 _g, r_f32 _b, r_f32 _a );
			ColorRGBf ( r_f32 *_rgba );
			//! キャストオペレータ
			operator ColorRGBi() const;
			operator ColorHSLf() const;
			//! RGBA成分が一致するか比較する
			r_bool	operator == ( const ColorRGBf &src ) const;
			r_bool	operator != ( const ColorRGBf &src ) const;
			//! 各成分を足し合わせる
			ColorRGBf operator + ( const ColorRGBf &src ) const;
			const ColorRGBf &operator += ( const ColorRGBf &src );
			//! 各成分を掛け合わせる
			ColorRGBf operator * ( const ColorRGBf &src ) const;
			const ColorRGBf &operator *= ( const ColorRGBf &src );
			//! 各成分に一律に引数srcを足し合わせる
			ColorRGBf operator + ( r_f32 src ) const;
			const ColorRGBf &operator += ( r_f32 src );
			//! 各成分に一律に引数srcを掛け合わせる
			ColorRGBf operator * ( r_f32 src ) const;
			const ColorRGBf &operator *= ( r_f32 src );
		public:
			union {
				struct {
					r_f32	r;
					r_f32	g;
					r_f32	b;
					r_f32	a;
				};
				r_f32	rgba[4];
				r_f32	c[4];
			};
		};
	}
}
#include "../rtti/r_rtti_reflection_typename.h"
namespace r{
	namespace rtti{
		//! r::math::ColorRGBf
		template<>
		static inline
		const r_cstr	getTypeNameStr<r::math::ColorRGBf>() {
			return _RST ( "r::math::ColorRGBf" );
		}
	}
}

#endif // _R_MATH_COLORRGBF_H_
